package com.jd.basic.service.impl;

import com.jd.basic.service.BaiduAiAuditService;
import com.jd.basic.util.BaiduAuditUtils;
import org.springframework.stereotype.Service;

@Service
public class BaiduAiAuditServiceImpl implements BaiduAiAuditService {

    @Override
    public Boolean textAudit(String text) {

        return BaiduAuditUtils.TextCensor(text);
    }

    @Override
    public Boolean imageAudit(String resources) {

        Boolean result = true;
        if (resources!=null) {
            String[] arr = resources.split(",");
            for (String s : arr) {
                // 只要有一张图片审核失败 = 宠物审核失败
                if (!BaiduAuditUtils.ImgCensor("http://123.207.27.208" + s)) {
                        result = false;
                        break;
                }
            }

        }
        return result;
    }
}
